package com.wy.shopping.service.impl;

import com.wy.common.utils.R;
import com.wy.shopping.vo.ActivityVo;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;
import java.util.Map;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.wy.common.utils.PageUtils;
import com.wy.common.utils.Query;

import com.wy.shopping.dao.MiaoshaActivityDao;
import com.wy.shopping.entity.MiaoshaActivityEntity;
import com.wy.shopping.service.MiaoshaActivityService;


@Service("miaoshaActivityService")
public class MiaoshaActivityServiceImpl extends ServiceImpl<MiaoshaActivityDao, MiaoshaActivityEntity> implements MiaoshaActivityService {
    @SuppressWarnings("all")
    @Autowired
    private MiaoshaActivityDao activityDao;

    @Override
    public PageUtils queryPage(Map<String, Object> params) {
        IPage<MiaoshaActivityEntity> page = this.page(
                new Query<MiaoshaActivityEntity>().getPage(params),
                new QueryWrapper<MiaoshaActivityEntity>()
        );
        return new PageUtils(page);
    }

    @Override
    public R miaoshaList(Map<String, Object> params) {
        String key = (String) params.get("key");
        List<ActivityVo> page = activityDao.miaoshaList(key);
        return R.ok().put("page",page);
    }

    @Override
    public ActivityVo hui(Long id) {
        return activityDao.hui(id);
    }

}